package com.song.guli.service.edu.controller;

import com.song.guli.common.base.result.R;
import org.springframework.web.bind.annotation.*;

/**
 * @author 宋超
 * HP - the login name of the current user.
 * 2021/3/30 - the current system date.
 * 8:52 - the current system time.
 * 临时登录接口
 */
//@CrossOrigin //解决跨域问题
@RestController
@RequestMapping("/user/")
public class LoginController {

    /**
     * 登录
     * @return
     */
    @PostMapping("login")
    public R login(){
        return R.ok().data("token","admin");
    }


    /**
     * 获取用户信息
     * @return
     */
    @GetMapping("info")
    public R getInfo(){
        return R.ok().data("roles","[admin]")
                .data("name","admin")
                .data("avatar","https://oss.aliyuncs.com/aliyun_id_photo_bucket/default_handsome.jpg");
    }

    /**
     * 退出
     * @return
     */
    @PostMapping("logout")
    public R logout(){
        return R.ok();
    }
}
